import React, { Component } from 'react'
import { Card, Button, Radio } from 'antd'
import './index.less'

class Buttons extends Component{

    state = {
        loading: true,
        size: 'default'
    }

    handleCloseLoading = () => {
        this.setState({
            loading: false
        })
    }
    handleChange = (e) => {
        this.setState({
            size: e.target.value
        })
    }
    render() {
        return(
            <div>
                <Card title="基础按钮" className="card-wrap card-wrap-margin">
                    <Button type="primary">确定</Button>
                    <Button >取消</Button>
                    <Button type="dashed">虚线</Button>
                    <Button type="danger">删除</Button>
                    <Button disabled>禁用</Button>
                </Card>
                <Card title="图形按钮" className="card-wrap card-wrap-margin">
                    <Button icon="plus">创建</Button>
                    <Button icon="edit">编辑</Button>
                    <Button icon="delete">删除</Button>
                    <Button icon="search" shape="circle"></Button>
                    <Button icon="download" >下载</Button>
                    <Button icon="upload" >下载</Button>
                </Card>
                <Card title="Loading按钮" className="card-wrap card-wrap-margin">
                    <Button  type="primary" loading={this.state.loading}>提交</Button>
                    <Button type="primary" shape="circle" loading={this.state.loading}></Button>
                    <Button loading={this.state.loading}>点击加载</Button>
                    <Button shape="circle" loading={this.state.loading}></Button>
                    <Button type="primary" onClick={this.handleCloseLoading}>关闭</Button>
                </Card>
                <Card title="按钮组" className="card-wrap-margin">
                    <Button.Group>
                        <Button type="primary" icon="left">前一页</Button>
                        <Button type="primary" icon="right">后一页</Button>
                    </Button.Group>
                </Card>
                <Card title="Loading按钮" className="card-wrap card-wrap-margin">
                    <Radio.Group value={this.state.size} 
                        onChange={this.handleChange}>
                        <Radio value="small">小</Radio>
                        <Radio value="default">中</Radio>
                        <Radio value="large">大</Radio>
                    </Radio.Group>
                    <Button type="primary" size={this.state.size}>确定</Button>
                    <Button size={this.state.size}>取消</Button>
                    <Button type="dashed" size={this.state.size}>虚线</Button>
                    <Button type="danger" size={this.state.size}>删除</Button>
                </Card>
            </div>
        )
    }
}

export default Buttons